From 6294397fbafa4fefe6e0671afe62d3f35e9e7b12 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Sat, 14 Jan 2006 21:26:40 +0100 Subject: [PATCH] Arch-specific per-vcpu info should be initialised to zero when allocating a new vcpu structure, not copied from CPU0's idle VCPU. Especially now that the idle VCPU itself is dynamically allocated. This should fix assertions people have been seeing in getdomain_info_ctxt() relation to IOPL in eflags. Signed-off-by: Keir Fraser --- xen/arch/x86/domain.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 19c29d084c..db764760b1 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -215,14 +215,10 @@ struct vcpu *alloc_vcpu_struct(struct domain *d, unsigned int vcpu_id) memset(v, 0, sizeof(*v)); - memcpy(&v->arch, &idle_vcpu[0]->arch, sizeof(v->arch)); v->arch.flags = TF_kernel_mode; if ( is_idle_domain(d) ) - { percpu_ctxt[vcpu_id].curr_vcpu = v; - v->arch.schedule_tail = continue_idle_domain; - } if ( (v->vcpu_id = vcpu_id) != 0 ) { @@ -333,10 +329,11 @@ int arch_do_createdomain(struct vcpu *v) memset(d->shared_info, 0, PAGE_SIZE); v->vcpu_info = &d->shared_info->vcpu_info[v->vcpu_id]; SHARE_PFN_WITH_DOMAIN(virt_to_page(d->shared_info), d); - - v->arch.schedule_tail = continue_nonidle_domain; } + v->arch.schedule_tail = is_idle_domain(d) ? + continue_idle_domain : continue_nonidle_domain; + return 0; fail_nomem: -- 2.30.2